package com.uphone.magicleafteacher.pro.adapter;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.uphone.magicleafteacher.R;
import com.uphone.magicleafteacher.util.CommonUtil;
import com.uphone.magicleafteacher.view.MyBaseViewHolder;
import com.uphone.magicleafteacher.vo.TeacherMsgBean;

import java.util.List;

public class MessageApapter extends BaseQuickAdapter<TeacherMsgBean.MsgListBean, MyBaseViewHolder> {
    public MessageApapter() {
        super(R.layout.item_message);
    }

    @Override
    protected void convert(@NonNull MyBaseViewHolder helper, TeacherMsgBean.MsgListBean item) {
        String time = CommonUtil.getStr(item.getMsgTime());
        helper.setText(R.id.text_date, time.length() > 3 ? time.substring(0, 4) : "");
        helper.setText(R.id.text_time, time.length() > 4 ? time.substring(5) : "");
        helper.setText(R.id.text_msg, CommonUtil.getStr(item.getMsg()));
    }
}
